<template>
<div class="layout" v-loading="loading">
  <div class="fianceCon">
    <div style="display: flex; justify-content: space-between">
      <Breadcrumb class="breadcrumb" :crumbs="crumbs"></Breadcrumb>
      <!-- <div class="backBtn" @click="goBack()">返回</div> -->
    </div>
    
    <div class="policyMsgTable">
      <div class="mail">
        <div class="login">
          <template v-if="!detail.companyLogo">
            {{detail.firstStr}}
          </template>
          <img  v-else :src="detail.companyLogo" />
        </div>
        <div class="titleBox">
          <div class="tit">
            <span>{{detail.financingName}}</span>
            <div class="titype">
              {{get_company_industry_text(detail.companyIndustryVal)}}
            </div>
          </div>
          <div class="describe">
            {{detail.financingIntroduce}}
          </div>
         
        </div>
        <div class="box2">
          <div>{{getTurnVal(detail.financingTurnVal)}}</div>
          <div>{{getStatusVal(detail.financingStatusVal)}}</div>
        </div>
        <div class="box2">
          <div>{{getceStatusVal(detail.financeStatusVal)}}</div>
          <div>{{detail.city}}</div>
        </div>
      </div>
      <div class="caseSun">
        <div class="sunitem">
          <span>融资类型：</span>
          <span>{{getcingTypeVal(detail.financingTypeVal)}}</span>
        </div>
        <div class="sunitem">
          <span>融资期限：</span>
          <span>{{detail.startTimeStr}}至{{detail.endTimeStr}}</span>
        </div>
        <div class="sunitem">
          <span>资金用途：</span>
          <span>{{detail.financingPurpose}}</span>
        </div>
      </div>
    </div>
    <div class="casedescribe">
      <div class="describe1">
        {{getdescribeTypeVal(detail.describeTypeVal)}}
      </div>
      <div class="describe2">
        {{detail.projectDescribe}}
      </div>
    </div>
    <div class="explainBox">
      <div class="explainTitle">
        <div class="tit">融资期望</div>
        <div class="con">
          <!-- 融资：￥1000万 出让股份10% 工程建设、技术设备购买与安装等。 -->
          {{detail.financingExpect}}
        </div>
      </div>
      <div class="explainTitle" v-if="detail.projectDetails">
        <div class="tit">项目详情</div>
        <div class="con" v-html="detail.projectDetails"></div>
      </div>
      <div class="explainTitle">
        <div class="tit">公司信息</div>
        <div class="con">
          {{detail.companyName}} <br>
          公司介绍：{{detail.financingIntroduce || '无'}} <br>
          公司官网：{{detail.officialWebsite || '无'}} <br>
          公司地址：{{detail.province}}{{detail.city}}{{detail.county}}{{detail.detailedAddress}}
        </div>
      </div>
    </div>
    <Buttons :buttons="buttons" @goBack="goBack" class="backBtn"></Buttons>
  </div>
</div>
</template>
<script>
  import { getFinancingSuccessDetails } from '@/common/api/finance'

	import Breadcrumb from '@/components/breadcrumb'
  export default {
    data(){
      return{
        buttons:[{text:"返回",type:"normal",size:"l",method:"goBack"}],
        loading: false,
        crumbs: [{
					label: '金融服务',
					value: 'finance'
				}, {
					label: '融资成功案例清单',
					value: 'financeCase',
				}, {
					label: '融资成功案例详情',
					value: '',
					choose: true
				}],
        companyFinancingId: null,
        detail: {},
        typeList: [],
        turnList: [],
        desTypeList: [],
        statusList: [],
        gstatusList:[],
        company_industry: []
      }
    },
    components: { 
      Breadcrumb
    },
    mounted(){
      // 通过路由获取产品id
      if(this.$route.query.companyFinancingId){
        this.companyFinancingId = this.$route.query.companyFinancingId
        this.getProductDetail()
      }
    },
    created(){
      this.gettypeList()
    },
    methods: {
      /**
			 * 返回上一页
			 */
			goBack() {
				this.$router.back();
      },
      // 获取详情数据
      async getProductDetail(){
        this.loading = true
        let {code , data, msg} = await getFinancingSuccessDetails(this.companyFinancingId)
        this.loading = false
        // console.log('res', res)
        if (code != '200') return this.$message.warning(msg)
        if(data && data.companyFinancing.companyName) {
          this.detail = data.companyFinancing
        }
      },
      // 字典查询 政策类别
      async gettypeList(){
        // 调用公共方法中的查询字典表
        this.getDictList(this,`finance_financing_type,finance_financing_turn,finance_describe_type,finance_com_finance_status,finance_com_financing_status,company_industry`).then(res => {
          //  融资类型		
          this.typeList = res.finance_financing_type
          //  融资的轮次
          this.turnList = res.finance_financing_turn
          //  项目描述类型	
          this.desTypeList = res.finance_describe_type
          //  公司财务状况		
          this.statusList = res.finance_com_finance_status
          //  公司财务状况		
          this.gstatusList = res.finance_com_financing_status
          this.company_industry = res.company_industry;
        })
      },
    },
    computed:{
      get_company_industry_text() {
        return function(value) {
          const item = this.company_industry.find(e => e.dictValue == value)
          return item ? item.dictLabel : ""
        }
      },
      getTurnVal(){
        return function(data){
          let turnList = this.turnList
          let obj = turnList.find(item => item.dictValue == data)
          return obj && obj.dictLabel
        }
      },
      
      getStatusVal(){
        return function(data){
          let turnList = this.gstatusList
          let obj = turnList.find(item => item.dictValue == data)
          return obj && obj.dictLabel
        }
      },
      getceStatusVal(){
        return function(data){
          let turnList = this.statusList
          let obj = turnList.find(item => item.dictValue == data)
          return obj && obj.dictLabel
        }
      },
      
      getcingTypeVal(){
        return function(data){
          let turnList = this.typeList
          let obj = turnList.find(item => item.dictValue == data)
          return obj && obj.dictLabel
        }
      },
      // 项目描述类型	
      getdescribeTypeVal(){
        return function(data){
          let turnList = this.desTypeList
          let obj = turnList.find(item => item.dictValue == data)
          return obj && obj.dictLabel
        }
      },
    }
  }
</script>
<style scoped>
  .breadcrumb {
		width: 1200px;
		margin-bottom: 30px;
	}
  .fianceCon{
    width: 1200px;
    margin: 0 auto;
    padding: 20px 0;
  }
.backBtn {
  color: #045db9;
  padding: 10px 0px;
  font-size: 15px;
  border-radius: 5px;
  /* margin-right: 20px; */
  transition: all 0.2s ease 0s;
  width: 120px;
  box-sizing: border-box;
  text-align: center;
  margin: 20px auto;
}

.backBtn:hover {
  cursor: pointer;
  box-shadow: 0px 0px 5px #eeeeee;
}
  .fianceCon .title{
    text-align: left;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
  }
  .fianceCon .title .tex{
    font-size: 24px;
    font-weight: 700;
  }
  .fianceCon .title .btn{
    width: 120px;
    height: 40px;
    line-height: 40px;
    background: #045db9;
    border-radius: 3px;
    color: #FFFFFF;
    text-align: center;
  }
  .fianceCon .policyMsgTable{
		border: 1px solid #e1e1e1;
		font-size: 14px;
    margin-bottom: 20px;
    padding: 30px;
    box-sizing: border-box;
  }
  .fianceCon .policyMsgTable .mail{
    display: flex;
    justify-content: flex-start;
  }
  .fianceCon .policyMsgTable .mail .login{
    width: 80px;
    height: 80px;
    background: #045db9;
    font-size: 41px;
    font-weight: 700;
    line-height: 80px;
    color: #ffffff;
    border-radius: 50%;
    margin-right: 15px;
    flex-shrink: 0;
  }
  .fianceCon .policyMsgTable .mail .login img{
    width: 78px;
    height: 78px;
  }
  .fianceCon .policyMsgTable .mail .titleBox{
    /* flex: 1; */
    margin-top: 18px;
    overflow: hidden;
  }
  .fianceCon .policyMsgTable .mail .titleBox .tit{
     font-size: 24px;
     color: #333333;
     font-weight: bold;
     display: flex;
     align-items: center;
     /* position: relative; */
     /* padding-right: 80px; */
  }
  .fianceCon .policyMsgTable .mail .titleBox .tit span {
    white-space:nowrap;
    text-overflow:hidden;
    text-overflow:ellipsis;
    overflow: hidden;
  }
  .fianceCon .policyMsgTable .mail .titleBox .describe{
    font-size: 14px;
    color: #999999;
    text-align: left;
  }
  .fianceCon .policyMsgTable .mail .titleBox .titype{
    font-size: 14px;
    background: rgba(252,172,18,.1);
    color: #fcac12;
    border-radius: 2px;
    padding: 3px 10px;
    margin-left: 13px;
    flex-shrink: 0;
  }
  .fianceCon .policyMsgTable .mail .box2{
    margin-left: 50px;
    margin-top: 18px;
    flex-shrink: 0;
  }
  .fianceCon .policyMsgTable .mail .box2 div:nth-child(1){
    font-size: 24px;
    color: #045db9;
    font-weight: 400;
  }
  .fianceCon .policyMsgTable .mail .box2 div:nth-child(2){
    color: #999999;
    font-size: 14px;
  }
  .fianceCon .policyMsgTable .caseSun{
    display: flex;
    flex-wrap: wrap;
    margin-top: 10px;
    margin-left: 98px;
  }
  .fianceCon .policyMsgTable .caseSun .sunitem{
    margin-right: 20px;
    font-size: 14px;
    text-align: left;
    display: flex;
    align-items: flex-start;
    margin-top: 5px;
  }
  .fianceCon .policyMsgTable .caseSun .sunitem span:nth-child(1){
    color: #999;
    flex-shrink: 0;
  }
  .fianceCon .policyMsgTable .caseSun .sunitem span:nth-child(2){
    color: #333;
    font-weight: bold;
  }
  .fianceCon .casedescribe{
    min-height: 110px;
    background: #ffffff;
    border: 1px solid #eeeeee;
    margin-bottom: 20px;
    box-sizing: border-box;
    padding: 20px 30px;
    text-align: left;
  }
  .fianceCon .casedescribe .describe1{
    font-size: 18px;
    color: #333;
    font-weight: bold;
  }
  .fianceCon .casedescribe .describe2{
    font-size: 14px;
    margin-top: 5px;
  }
  .fianceCon .explainBox{
     border: 1px solid #EEEEEE;
     padding: 24px 14px;
  }
  .fianceCon .explainBox .explainTitle{
    margin-bottom: 30px;
  }
  .fianceCon .explainBox .explainTitle .tit{
    font-size: 18px;
    font-weight: 700;
    text-align: left;
    color: #045db9;
    position: relative;
    margin-left: 14px;
  }
   .fianceCon .explainBox .explainTitle .tit:after{
      content: '';
      position: absolute;
      left: -14px;
      top: 3px;
      width: 3px;
      height: 18px;
      background: #045db9;
   }
  .fianceCon .explainBox .explainTitle .con{
    font-size: 14px;
    color: #666666;
    line-height: 24px;
    text-align: left;
    margin-left: 14px;
    margin-top: 10px;
  }
  .fianceCon .explainBox .download{
    display: flex;
    margin-top: 30px;
    margin-left: 10px;
  }
  .fianceCon .explainBox .download .dowtit{
    font-size: 14px;
    color: #666666;
  }
  .fianceCon .explainBox .download  .dowcon{
    flex: 1;
    margin-left: 12px;
    text-align: left;
  }
  .fianceCon .explainBox .download  .dowcon .item{
    color: #045DB9;
    font-size: 14px;
    margin-bottom: 12px;
  }
  .fianceCon .explainBox .download .dowcon .item:last-child{
    margin-bottom: 0;
  }
</style>